package cn.kk.Blog.controller.blog;
/*
 *@author KK on 2022.12.02 11:36
 */

import cn.kk.Blog.core.servlet.BaseServlet;
import cn.kk.Blog.entity.TSystemUser;
import cn.kk.Blog.entity.TUser;
import cn.kk.Blog.service.IUserService;
import cn.kk.Blog.service.impl.UserServiceImpl;
import com.alibaba.fastjson.JSON;

import javax.servlet.annotation.WebServlet;

@WebServlet("/UserServlet/*")
public class UserServlet extends BaseServlet {
    private IUserService userService = new UserServiceImpl();
    public void getUserByName() throws Exception {
        String username = super.req.getReader().readLine();
        TUser userByName = userService.getUserByName(username);
        String jsonString = JSON.toJSONString(userByName);
        super.resp.getWriter().write(jsonString);
    }
    public void register() throws Exception {
        String json = super.req.getReader().readLine();
        TSystemUser user = JSON.parseObject(json, TSystemUser.class);
        super.resp.getWriter().write("您已注册，请登录邮箱激活！");
    }
}
